<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller{
    public function login(){ 
        $this->assign('title','登录');
        $this->display('Login');
    }    
    public function checklogin(){            
            $userInfo=D('User');
            $login=$userInfo->create();
            $map['name']=$login['name'];
            $map['password']=$login['password'];            
            $hasUser= $userInfo->where($map)->find();          
            if ($hasUser){               
                session("name",$hasUser['name']);
                session("password",$hasUser['password']);               
                session("uid",$hasUser['id']);               
                $this->success('登录成功',U('Index/Index'));
            }
            else {
                $this->error('用户名或密码有误');
            }
                       
    }
    

    public function logout() {
        session('[destroy]');
        $this->redirect('Login/Login');
    
    }
    
}